package com.vanzo.encryption;

import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import java.util.List;

/**
 * Created by tisen on 2018/2/6.
 */

public class TestActivity extends AppCompatActivity {

    private TextView console;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_test);
        console = (TextView) findViewById(R.id.test_console);
    }

    @Override
    protected void onStart() {
        super.onStart();
        ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
        PackageManager pm = getPackageManager();

        List<ActivityManager.RunningAppProcessInfo> infos = manager.getRunningAppProcesses();
        for (ActivityManager.RunningAppProcessInfo info :
                infos) {
            console.append(info.processName + "\r\n");
        }
    }
}
